sgwt_cheby_eval : Evaluate shifted Chebyshev polynomial on given domain function r=sgwt_cheby_eval(x,c,arange) Compute Chebyshev polynomial of laplacian applied to input. This is primarily for visualization Inputs: x - input values to evaluate polynomial on c - Chebyshev coefficients (c(1+j) is jth coefficient) arange - interval of approximation. Note that x need not be inside arange, but the polynomial will no longer be near the approximated function outside of arange.
0001 % sgwt_cheby_eval : Evaluate shifted Chebyshev polynomial on given domain 0002 % 0003 % function r=sgwt_cheby_eval(x,c,arange) 0004 % 0005 % Compute Chebyshev polynomial of laplacian applied to input. 0006 % This is primarily for visualization 0007 % 0008 % Inputs: 0009 % x - input values to evaluate polynomial on 0010 % c - Chebyshev coefficients (c(1+j) is jth coefficient) 0011 % arange - interval of approximation. Note that x need not be inside 0012 % arange, but the polynomial will no longer be near the 0013 % approximated function outside of arange. 0014 0015 % This file is part of the SGWT toolbox (Spectral Graph Wavelet Transform toolbox) 0016 % Copyright (C) 2010, David K. Hammond. 0017 % 0018 % The SGWT toolbox is free software: you can redistribute it and/or modify 0019 % it under the terms of the GNU General Public License as published by 0020 % the Free Software Foundation, either version 3 of the License, or 0021 % (at your option) any later version. 0022 % 0023 % The SGWT toolbox is distributed in the hope that it will be useful, 0024 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0025 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0026 % GNU General Public License for more details. 0027 % 0028 % You should have received a copy of the GNU General Public License 0029 % along with the SGWT toolbox. If not, see <http://www.gnu.org/licenses/>. 0030 0031 function r=sgwt_cheby_eval(x,c,arange) 0032 % By setting the operator L to mean (pointwise) multiplication by x, 0033 % and f to be vector of ones, p(L)f will contain p(x) at each 0034 % point. This lets us use sgwt_cheby_op to evaluate the Chebyshev polynomials. 0035 L=spdiags(x(:),0,speye(numel(x))); 0036 f=ones(size(x(:))); 0037 r=sgwt_cheby_op(f,L,c,arange); 0038 0039 if iscell(r) 0040 for k=1:numel(r) 0041 r{k}=reshape(r{k},size(x)); 0042 end 0043 else 0044 r=reshape(r,size(x)); 0045 end 0046 0047 0048 0049 0050